;(function($) {
	var fetchData = function( me, config ) {
			$.getJSON(config.url, function( data ) {
				return config.data;
			});
		},
		associateEvents = function( elements, config ) {
			$( elements ).each(function(index, element) {
				$( element ).keyup(function() {
					if(config.url) {
						config.data = fetchData( this, config);
						console.log(config.data);
					}

				});
			});
		};

	$.extend($.fn, {
		dynamicDropdown: function( _config ) {
			var config = {
					url: null,
					data: null,
					htmlStructure: null,
					template: null
				};
			
			$.extend(config, _config);
			
			associateEvents( this, config );
		}
	});
})(jQuery);
